// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  let dataName=event.dataName;
  const db = cloud.database();
  let res=await db.collection(dataName).where({
    num:event.num
  }).update({
    data: event.obj
  }).then(res=>{
    if (res.stats.updated>0) {
      return 200;
    }else{
      return 0;
    }
  })
  return{
    result:res,
  }
}